package com.neo.config;

/**
 * @ProjectName: com-xinwo
 * @Package: com.xinwo.v1.config
 * @Description: java类作用描述
 * @Author: 郭鍌
 * @CreateDate: 2019/1/15 16:20
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/1/15 16:20
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */

import com.neo.common.BaseMapper;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import tk.mybatis.spring.mapper.MapperScannerConfigurer;

import java.util.Properties;
@Slf4j
@Configuration
@AutoConfigureAfter(MybatisAutoConfiguration.class)
public class MyBatisMapperScannerConfig {

    @Bean
    public MapperScannerConfigurer mapperScannerConfigurer() {
        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
        mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
        mapperScannerConfigurer.setBasePackage("com.neo.mapper");
        Properties properties = new Properties();
        properties.setProperty("mappers", BaseMapper.class.getName());
        properties.setProperty("notEmpty", "false");
        properties.setProperty("IDENTITY", "MYSQL");
        properties.setProperty("ORDER","AFTER");
        mapperScannerConfigurer.setProperties(properties);
        return mapperScannerConfigurer;
    }

}